home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Taifun
/
Taifun 156 (1991-03-10)(Manewaldt, A.)(DE)(PD).zip
/
Taifun 156 (1991-03-10)(Manewaldt, A.)(DE)(PD).adf
/
Mem-Controller
/
Mem-Controller.asm
< prev
next >
Wrap
Assembly Source File
|
1991-02-18
|
8KB
|
475 lines
* MEM-CONTROLLER (w) (c) by E.Hambuch
* 21.12.90
* E.Hambuch
* Prinzenstr. 9
* D-5330 Könisgwinter 1
* Freeware
* Wer Verbesserungen vornehmen will, darf dieses gerne tun !
* Er muß jedoch meinen Namen hier drin stehen lassen und das Programm
* als PD veröffentlichen
NOLIST
include 'exec.i'
include 'intuition.i'
include 'graphics.i'
include 'dos.i'
include 'startup.i'
LIST
_main:
lea intname,a1
CALLEXEC OldOpenLibrary
move.l d0,_IntBase
beq ende
lea dosname,a1
jsr _LVOOldOpenLibrary(a6)
move.l d0,_DOSBase
beq closeint
lea gfxname,a1
jsr _LVOOldOpenLibrary(A6)
move.l d0,_GfxBase
beq closedos
lea windowstr1,a0
CALLINT OpenWindow
move.l d0,Window1
beq closegfx
move.l d0,a0
move.l 50(a0),RPort1
move.l 86(a0),MsgPort1
move.l 4,a1
lea _LVOAllocMem,a0
move.l #NewAllocMem,d0
CALLEXEC SetFunction
move.l d0,Vektor1
move.l 4,a1
lea _LVOAvailMem,a0
move.l #NewAvailMem,d0
jsr _LVOSetFunction(a6)
move.l d0,Vektor2
forever1:
move.l Delay,d1
lsr.w #1,d1
beq.s fore1
CALLDOS Delay
fore1:
move.l MsgPort1,a0
CALLEXEC GetMsg
tst.l d0
bne msg1
move.l Delay,d1
lsr.w #1,d1
beq.s fore2
CALLDOS Delay
fore2: bsr updatemem
move.l MsgPort1,a0
CALLEXEC GetMsg
tst.l d0
bne.s msg1
bra forever1
msg1:
move.l d0,a1
move.l 20(a1),d2
jsr _LVOReplyMsg(A6)
cmp.l #CLOSEWINDOW,d2
beq closeall
cmp.l #MENUPICK,d2
bne forever1
lea windowstr2,a0
CALLINT OpenWindow
move.l d0,Window2
beq forever1
move.l d0,a0
move.l 86(a0),MsgPort2
forever2: bsr updatemem2
bsr updatemem
move.l Delay,d1
lsr.w #1,d1
beq.s fore3
CALLDOS Delay
fore3:
move.l MsgPort2,a0
CALLEXEC GetMsg
tst.l d0
bne msg2
move.l Delay,d1
lsr.w #1,d1
beq.s fore4
CALLDOS Delay
fore4:
bsr updatemem2
move.l MsgPort2,a0
CALLEXEC GetMsg
tst.l d0
beq forever2
msg2:
move.l d0,a1
move.l 20(a1),d2
move.l 28(a1),a2
jsr _LVOReplyMsg(a6)
cmp.l #MENUPICK,d2
bne.s fore5
move.l Window2,a0
CALLINT CloseWindow
bra forever1
fore5:
cmp.l #GADGETUP,d2
bne forever2
move.w 38(a2),d0
cmp.w #4,d0
bhi forever2
add.w d0,d0
add.w d0,d0
lea JumpTable,a0
move.l 0(a0,d0.w),a0
jsr (a0)
bra forever2
closeall:
move.l 4,a1
lea _LVOAllocMem,a0
move.l Vektor1,d0
CALLEXEC SetFunction
move.l 4,a1
lea _LVOAvailMem,a0
move.l Vektor2,d0
jsr _LVOSetFunction(a6)
closewin1:
move.l Window1,a0
CALLINT CloseWindow
closegfx:
move.l _GfxBase,a1
CALLEXEC CloseLibrary
closedos:
move.l _DOSBase,a1
jsr _LVOCloseLibrary(a6)
closeint:
move.l _IntBase,a1
jsr _LVOCloseLibrary(A6)
ende: moveq #0,d0
rts
updatemem:
moveq #MEMF_CHIP,d1
CALLEXEC AvailMem
move.l d0,d3
lea Buf1,a0
bsr dez
moveq #MEMF_FAST,d1
jsr _LVOAvailMem(a6)
move.l d0,d3
lea Buf2,a0
bsr dez
moveq #MEMF_PUBLIC,d1
jsr _LVOAvailMem(A6)
move.l d0,d3
lea Buf3,a0
bsr dez
move.l RPort1,a0
lea MemIText,a1
moveq #31,d0
moveq #1,d1
move.l _IntBase,a6
jmp _LVOPrintIText(A6)
dez:
lea deztab,a1
moveq #0,d1
dez2: moveq #'0'-1,d2
move.l d1,d4
lsl.l #2,d4
dez3: addq.b #1,d2
move.l d3,d5
sub.l 0(a1,d4.w),d3
bcc.s dez3
move.l d5,d3
move.b d2,0(a0,d1.w)
addq.b #1,d1
cmp.b #8,d1
bne dez2
moveq #6,d1
dez4: move.b (a0)+,d0
cmp.b #'0',d0
bne.s dez5
move.b #' ',-1(a0)
dbra d1,dez4
dez5: rts
updatemem2:
moveq #MEMF_CHIP,d1
CALLEXEC AvailMem
move.l d0,d3
lea MemText3+6,a0
bsr dez
moveq #MEMF_FAST,d1
jsr _LVOAvailMem(a6)
move.l d0,d3
lea MemText3+16,a0
bsr dez
moveq #MEMF_PUBLIC,d1
jsr _LVOAvailMem(a6)
move.l d0,d3
lea MemText3+26,a0
bsr dez
move.l #MEMF_CHIP!MEMF_LARGEST,d1
jsr _LVOAvailMem(A6)
move.l d0,d3
lea MemText4+6,a0
bsr dez
move.l #MEMF_FAST!MEMF_LARGEST,d1
jsr _LVOAvailMem(a6)
move.l d0,d3
lea MemText4+16,a0
bsr dez
move.l #MEMF_FAST!MEMF_LARGEST,d1
jsr _LVOAvailMem(a6)
move.l d0,d3
lea MemText4+26,a0
bsr dez
move.l Window2,a0
move.l 50(a0),a0
lea MemIText2,a1
moveq #20,d0
moveq #20,d1
move.l _IntBase,a6
jmp _LVOPrintIText(a6)
Sub1:
move.l StrInfo+28,d0
cmp.b #9,d0
bhi ende
mulu #50,d0
move.l d0,Delay
rts
Sub2: ;NoFastMem
Sub3:
rts
Sub4:
move.l #80000000,d0
moveq #MEMF_PUBLIC,d1
CALLEXEC AllocMem
move.l d0,d1
beq ende
move.l d0,a1
move.l #80000000,d0
jmp _LVOFreeMem(a6)
Sub5: CALLEXEC Forbid
move.l Window2,a0
move.l 46(a0),a1 ;WBenchScreen
cmp.b #1,184+5(a1)
beq Sub5end
moveq #0,d0
subq.b #1,184+5(a1)
move.b 184+5(a1),d0
lsl.w #2,d0
lea 184(a1),a1
move.l 8(a1,d0.w),a0
clr.l 8(a1,d0.w)
move.w (a1),d0
lsl.w #3,d0
move.w 2(a1),d1
CALLGRAF FreeRaster
CALLINT RemakeDisplay
Sub5end: move.l _ExecBase,a6
jmp _LVOPermit(a6)
NewAllocMem:
cmp.w #SELECTED!GADGHCOMP,Gadget2+12
bne.s OnlyChip
btst #2,d1
bne.s OldAllocMem
or.b #MEMF_CHIP!MEMF_PUBLIC,d1
OnlyChip:
cmp.w #SELECTED!GADGHCOMP,Gadget3+12
bne.s OldAllocMem
bclr #2,d1
bset #1,d1
OldAllocMem:
dc.w $4ef9 ;Code für JMP x.L
Vektor1: dc.l 0
NewAvailMem:
cmp.w #SELECTED!GADGHCOMP,Gadget2+12
bne.s NewAvailMem2
btst #2,d1
bne.s OldAvailMem
or.b #%11,d1
NewAvailMem2:
cmp.w #SELECTED!GADGHCOMP,Gadget3+12
bne.s OldAvailMem
btst #2,d1
beq.s onlc
moveq #0,d0
rts
onlc:
tst.l d1
beq.s onlc2
btst #0,d1 ;MEMF_PUBLIC ?
beq.s OldAvailMem
onlc2:
bset #1,d1 ;->MEMF_CHIP
OldAvailMem:
dc.w $4ef9
Vektor2: dc.l 0
DATA
Titel: dc.b ' Mem-CONTROLLER by E.Hambuch',0
intname: dc.b 'intuition.library',0
dosname: dc.b 'dos.library',0
gfxname: dc.b 'graphics.library',0
topazname: dc.b 'topaz.font',0
Text1: dc.b 'Update:',0
Text2: dc.b 'NoFastMem',0
Text3: dc.b 'Only Chip',0
Text4: dc.b ' MoreMem',0
Text5: dc.b 'KillBitpl',0
Text6: dc.b 'AllocFast',0
StrBuffer: dc.b '2',0,0
MemText: dc.b 'Chip: '
Buf1: dc.b '00000000 Fast: '
Buf2: dc.b '00000000 Total: '
Buf3: dc.b '00000000 ',0
MemText2:
dc.b ' Chip Fast Total',0
MemText3:
dc.b 'Free 00000000 00000000 00000000',0
MemText4:
dc.b 'Larg. 00000000 00000000 00000000',0
EVEN
JumpTable:
dc.l Sub1,Sub2,Sub3,Sub4,Sub5
deztab:
dc.l 10000000
dc.l 1000000
dc.l 100000
dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
windowstr1:
dc.w 10,0,470,10
dc.b 1,2
dc.l MENUPICK!CLOSEWINDOW
dc.l WINDOWDRAG!WINDOWDEPTH!WINDOWCLOSE
dc.l 0,0,Titel,0,0
ds.w 4
dc.w WBENCHSCREEN
windowstr2:
dc.w 10,0,320,105
dc.b 0,1
dc.l GADGETUP!MENUPICK
dc.l WINDOWDRAG!WINDOWDEPTH!ACTIVATE
dc.l Gadget1,0,Titel,0,0
ds.w 4
dc.w WBENCHSCREEN
Gadget1:
dc.l Gadget2
dc.w 80,60
dc.w 40,10
dc.w GADGHCOMP
dc.w LONGINT!RELVERIFY!STRINGCENTER
dc.w STRGADGET
dc.l Border1,0,IText1
dc.l 0,StrInfo
dc.w 0
dc.l 0
Gadget2:
dc.l Gadget3
dc.w 20,75
dc.w 100,10
dc.w GADGHCOMP
dc.w RELVERIFY!TOGGLESELECT
dc.w BOOLGADGET
dc.l Border2,0,IText2
dc.l 0,0
dc.w 1
dc.l 0
Gadget3:
dc.l Gadget4
dc.w 20,90
dc.w 100,10
dc.w GADGHCOMP
dc.w RELVERIFY!TOGGLESELECT
dc.w BOOLGADGET
dc.l Border2,0,IText3
dc.l 0,0
dc.w 2
dc.l 0
Gadget4:
dc.l Gadget5
dc.w 150,60
dc.w 100,10
dc.w GADGHCOMP
dc.w RELVERIFY
dc.w BOOLGADGET
dc.l Border2,0,IText4
dc.l 0,0
dc.w 3
dc.l 0
Gadget5:
dc.l 0
dc.w 150,75
dc.w 100,10
dc.w GADGHCOMP
dc.w RELVERIFY
dc.w BOOLGADGET
dc.l Border2,0,IText5
dc.l 0,0
dc.w 4
dc.l 0
StrInfo:
dc.l StrBuffer
dc.l 0
dc.w 0,2,0,0,2,0,0,0
dc.l 0,2,0
Border1:
dc.w -1,-1
dc.b 1,0,0,5
dc.l Koords1,0
Koords1: dc.w 0,0,42,0,42,11,0,11,0,0
Border2:
dc.w -1,-1
dc.b 1,0,0,5
dc.l Koords2,0
Koords2: dc.w 0,0,101,0,101,11,0,11,0,0
IText1:
dc.b 1,0,0,0
dc.w -60,1
dc.l TextAttr,Text1,0
IText2:
dc.b 1,0,0,0
dc.w 15,1
dc.l TextAttr,Text2,0
IText3:
dc.b 1,0,0,0
dc.w 15,1
dc.l TextAttr,Text3,0
IText4:
dc.b 1,0,0,0
dc.w 15,1
dc.l TextAttr,Text4,0
IText5:
dc.b 1,0,0,0
dc.w 15,1
dc.l TextAttr,Text5,0
MemIText:
dc.b 1,2,1,0
dc.w 0,0
dc.l TextAttr,MemText,0
MemIText2:
dc.b 1,0,1,0
dc.w 0,0
dc.l TextAttr,MemText2,MemIText3
MemIText3:
dc.b 1,0,1,0
dc.w 0,10
dc.l TextAttr,MemText3,MemIText4
MemIText4:
dc.b 1,0,1,0
dc.w 0,20
dc.l TextAttr,MemText4,0
TextAttr: dc.l topazname
dc.w 8,0
Delay: dc.l 100
BSS
_IntBase: ds.l 1
_DOSBase: ds.l 1
_GfxBase: ds.l 1
Window1: ds.l 1
RPort1: ds.l 1
MsgPort1: ds.l 1
Window2: ds.l 1
MsgPort2: ds.l 1
END